package com.woniu.finance.contorller;


import com.woniu.aop.OperationLogAnnotation;
import com.woniu.finance.entity.Department;
import com.woniu.finance.service.IDepartmentService;
import com.woniu.util.utils.HttpResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 部门表 前端控制器
 * </p>
 *
 * @author 刘品水
 * @since 2023-04-25
 */
@RestController
@RequestMapping("/finance/department")
public class DepartmentController {
    @Autowired
    private IDepartmentService departmentService;

    /**
     * @Description: 保存部门表信息
     * @Param: [asset]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */
    @PostMapping("saveDepartment")
    @OperationLogAnnotation(operModul = "融资企业-新增部门表",operType = "新增",operDesc = "新增部门表")//操作日志注解
    public HttpResult<?> saveDepartment(@RequestBody Department asset) {

        return departmentService.saveDepartment(asset);
    }

    /**
     * @Description: 根据id删除部门表
     * @Param: [id]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */
    @RequestMapping("removeDepartmentById")
    @OperationLogAnnotation(operModul = "融资企业-根据id删除部门表",operType = "删除",operDesc = "根据id删除部门表")//操作日志注解
    public HttpResult<?> removeDepartmentById(Integer id) {
        return departmentService.removeDepartmentById(id);
    }

    /**
     * @Description: 修改部门表信息
     * @Param: [asset]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */

    @RequestMapping("modifyDepartment")
    @OperationLogAnnotation(operModul = "融资企业-修改部门表",operType = "修改",operDesc = "修改部门表信息")//操作日志注解
    public HttpResult<?> modifyDepartment(@RequestBody Department asset) {
        return departmentService.modifyDepartment(asset);
    }

    /**
     * @Description: 根据id查询部门表
     * @Param: [id]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */
    @RequestMapping("findDepartmentById")
    @OperationLogAnnotation(operModul = "融资企业-根据id查询部门表",operType = "查询",operDesc = "根据id查询部门表")//操作日志注解
    public HttpResult<?> findDepartmentById(Integer id) {
        return departmentService.findDepartmentById(id);
    }
    /**
     * @Description: 查询所有部门表
     * @Param: [id]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */
    @RequestMapping("findAllDepartment")
    @OperationLogAnnotation(operModul = "融资企业-查询所有部门表",operType = "查询",operDesc = "查询所有部门表")//操作日志注解
    public HttpResult<?> findAllDepartment() {
        return departmentService.findAllDepartment();
    }

}
